package Class对象功能的演示;

import 反射中Class对象的创建.Person;

import java.lang.reflect.Constructor;

/**
 * @Auther:云尚学Java
 */
public class ReflectDemo2 {
    public static void main(String[] args) throws Exception {
        //2. 类名.class：通过类名的属性class获取
        Class personClass= Person.class;
        System.out.println("2:"+personClass);
        System.out.println("-----------");
        //获取公有的构造方法
        Constructor constructor=personClass.getDeclaredConstructor(String.class,int.class);
        System.out.println(constructor);
        Person person=(Person)constructor.newInstance("张三",80);
        System.out.println(person);
    }
}
